/*
 * import { cloneObject } from "@/util/cloneObject";
 * cloneObject(target, true)
 */


function cloneObject(o, d) {
	if (o === null || o === undefined || typeof o !== 'object') {
		return o;
	}

	var deep = !!d;
	var cloned;

	if (o.constructor === Array) {
		if (deep === false) {
			return o;
		}
		cloned = [];
		for (var i in o) {
			cloned.push(cloneObject(o[i], deep));
		}
		return cloned;
	}

	cloned = {};
	for (var j in o) {
		cloned[j] = deep ? cloneObject(o[j], true) : o[j];
	}
	return cloned;
}
export { cloneObject };
